package com.qf.ssm.service.impl;
/*
   @author 86155
   @ClassName: com.qf.ssm.service.impl.ClassifyServiceImpl
   @Description: 该类的功能描述
   @date: 2021/10/12 19:22 
*/

import com.github.pagehelper.PageHelper;
import com.qf.ssm.entity.Store;
import com.qf.ssm.mapper.ClassifyAppMapper;
import com.qf.ssm.service.ClassifyAppService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class ClassifyAppServiceImpl implements ClassifyAppService {
    @Resource
    private ClassifyAppMapper classifyAppMapper;

    /**
     * 按销量排序
     * @param sales 排序规则 1表示升序 0 表示降序
     * @param page
     * @param size
     * @return
     */
    @Override
    public List<Store> classifyStoreBySales(Long sales, Integer page, Integer size) {
        PageHelper.startPage(page, size);
        List<Store> stores = classifyAppMapper.selectStoreBySales(sales);
        return stores;
    }

    @Override
    public List<Store> classifyStoreByScore(Long score, Integer page, Integer size) {
        PageHelper.startPage(page, size);
        List<Store> stores = classifyAppMapper.selectStoreByScore(score);
        return stores;
    }

    @Override
    public List<Store> findAllStore(Integer page, Integer size) {
        PageHelper.startPage(page, size);
        List<Store> stores = classifyAppMapper.selectAllStore();
        return stores;
    }
}
